package com.ceilcell.wx.atservice.service.impl;

import com.ceilcell.wx.atservice.mapper.AccessTokenMapper;
import com.ceilcell.wx.atservice.model.AccessToken;
import com.ceilcell.wx.atservice.service.AccessTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2017/4/19.
 */
@Service("accessTokenService")
public class AccessTokenServiceImpl implements AccessTokenService {

    @Autowired
    AccessTokenMapper accessTokenMapper;

    public void saveAccessToken(AccessToken accessToken) {
        accessTokenMapper.insert(accessToken);
    }

    public void updateAccessToken(AccessToken accessToken) {
        accessTokenMapper.updateByPrimaryKey(accessToken);
    }

    public AccessToken findAccessTokenById(int tokenId) {
        return accessTokenMapper.selectByPrimaryKey(tokenId);
    }

    public void deleteAccessToken(AccessToken accessToken) {
        accessTokenMapper.deleteByPrimaryKey(accessToken.getTokenId());
    }
}
